package com.example.log.service;


import com.example.log.entity.OperationLog;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.stereotype.Service;

@Service
public class LogPusService {

    @Autowired
    @Qualifier("logTopic")
    private ChannelTopic logTopic;
    @Resource
    private RedisTemplate<String, Object> redisTemplate;


    /**
     * 发布日志消息
     * @param operationlog
     */
    public void convertAndSend(OperationLog operationlog){
        redisTemplate.convertAndSend(logTopic.getTopic(), operationlog);
    }
    
}
